#ifndef FILEREADER_H
#define FILEREADER_H

#include "EncoderSettings.h"
#include "DecoderSettings.h"
#include "Matrix.h"
#include "Frame.h"
#include "BitStream.h"
#include <fstream>
using namespace std;

class FileReader
{
public:
    FileReader() {}
    ~FileReader() {}

    EncoderSettings readEncoderSettings(string filename);
    DecoderSettings readDecoderSettings(string filename);
    QuantizationMatrix* readMatrix(string filename);

    void openFile(string filename);
    // status == true if successful
    Frame *readCompressedData(bool &status);
    Frame *readUncompressedData(int frameSize, bool &status);
	string readLine();
	int getFileSize();
    void closeFile();

private:
    ifstream _file;

    void addEncoderSetting(EncoderSettings &config, string &line) throw();
    void addDecoderSetting(DecoderSettings &config, string &line) throw();
    void addMatrixRow(string &line, int *m, int &position) throw();
};

#endif // FILEREADER_H
